<article class="_2rhmJa"><blockquote>
<p>Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。</p>
</blockquote>
<h1>搭建</h1>
<p>搭建前提请先安装以下程序：</p>
<ul>
<li><p>Node.js</p></li>
<li><p>Git</p></li>
</ul>
<p>安装完成后，使用 Node.js 命令行工具执行以下命令</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">npm install -g hexo-cli
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<h2>建站</h2>
<ul>
<li>码云创建新的项目（公开私有均可)。然后进入新项目，在服务选项中找到 Page 点击进入</li>
</ul>
<div class="image-package">
<div class="image-container" style="max-width: 700px; max-height: 182px; background-color: transparent;">
<div class="image-container-fill" style="padding-bottom: 18.94%;"></div>
<div class="image-view" data-width="961" data-height="182"><img data-original-src="//upload-images.jianshu.io/upload_images/10948567-48439139bf5c14f7" data-original-width="961" data-original-height="182" data-original-format="image/png" data-original-filesize="31684" style="cursor: zoom-in;" data-image-index="0" class="" src="//upload-images.jianshu.io/upload_images/10948567-48439139bf5c14f7?imageMogr2/auto-orient/strip|imageView2/2/w/961"></div>
</div>
<div class="image-caption">进入 Page 页</div>
</div>
<ul>
<li>开启 Page 服务</li>
</ul>
<div class="image-package">
<div class="image-container" style="max-width: 365px; max-height: 176px; background-color: transparent;">
<div class="image-container-fill" style="padding-bottom: 48.22%;"></div>
<div class="image-view" data-width="365" data-height="176"><img data-original-src="//upload-images.jianshu.io/upload_images/10948567-a3a4d755af38b110" data-original-width="365" data-original-height="176" data-original-format="image/png" data-original-filesize="14173" style="cursor: zoom-in;" data-image-index="1" class="" src="//upload-images.jianshu.io/upload_images/10948567-a3a4d755af38b110?imageMogr2/auto-orient/strip|imageView2/2/w/365"></div>
</div>
<div class="image-caption">开启 Page 服务</div>
</div>
<ul>
<li>开启后，复制下面的网站地址，后面要用到。<strong>这也是搭建好之后你的博客地址</strong>
</li>
</ul>
<div class="image-package">
<div class="image-container" style="max-width: 352px; max-height: 186px; background-color: transparent;">
<div class="image-container-fill" style="padding-bottom: 52.839999999999996%;"></div>
<div class="image-view" data-width="352" data-height="186"><img data-original-src="//upload-images.jianshu.io/upload_images/10948567-0e2cd2637f5c2349" data-original-width="352" data-original-height="186" data-original-format="image/png" data-original-filesize="15069" style="cursor: zoom-in;" data-image-index="2" class="" src="//upload-images.jianshu.io/upload_images/10948567-0e2cd2637f5c2349?imageMogr2/auto-orient/strip|imageView2/2/w/352"></div>
</div>
<div class="image-caption">网站路径</div>
</div>
<ul>
<li>本地依次执行以下命令，Hexo 就会安装在 F:/Hexo 文件夹中。当然，这个文件夹是任意的。</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">hexo init F:/Hexo
cd F:/Hexo
npm install
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>然后 Git 到码云的新项目上（Git 相关知识请转站-&gt;<a href="https://links.jianshu.com/go?to=https%3A%2F%2Fwww.liaoxuefeng.com%2Fwiki%2F0013739516305929606dd18361248578c67b8067c8c017b000" target="_blank">廖雪峰</a>）</li>
</ul>
<h2>配置</h2>
<p>安装目录下的 _config.yml 是主要的配置文件，包含以下的配置</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml">
<span class="token key atrule">title</span><span class="token punctuation">:</span> 标题

<span class="token key atrule">subtitle</span><span class="token punctuation">:</span> 副标题

<span class="token key atrule">description</span><span class="token punctuation">:</span> 描述

<span class="token key atrule">keywords</span><span class="token punctuation">:</span> <span class="token comment"># 暂时不知道作什么的</span>

<span class="token key atrule">author</span><span class="token punctuation">:</span> <span class="token key atrule">作者language</span><span class="token punctuation">:</span> zh<span class="token punctuation">-</span>CN <span class="token comment"># 使用中文</span>

<span class="token key atrule">timezone</span><span class="token punctuation">:</span> <span class="token comment"># 时区，默认使用电脑时区</span>

<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>配置网址，url 即为上面复制的网站地址，root 是地址最后一节</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token key atrule">url</span><span class="token punctuation">:</span> http<span class="token punctuation">:</span>//itscloudy.gitee.io/blog
<span class="token key atrule">root</span><span class="token punctuation">:</span> /blog/
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre></div>
<ul>
<li>配置 Deploy（repo 为新建项目的地址）</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token key atrule">deploy</span><span class="token punctuation">:</span>
  <span class="token key atrule">type</span><span class="token punctuation">:</span> git
  <span class="token key atrule">repo</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//gitee.com/itscloudy/Blog.git

<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>然后执行 server 命令，本地测试。进入标题为“Hello World”页面即已成功一半。</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token comment"># 默认地址 http://localhost:4000</span>
hexo server
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre></div>
<h1>开始创作！</h1>
<h2>写博客</h2>
<p>首先要了解 ，HEXO 支持的是 Markdown</p>
<p>现在，创建一篇文章。执行以下命令（例：hexo new "Hexo+码云 从搭建到管理一站解决"）</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml">hexo new
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<p>执行之后，在 source/_post 文件夹下会出现对应名称的 Markdown 文件。或者，可以直接将写好的 Markdown 放到 source/_post 里</p>
<p>Markdown 的相关知识自行百度，CSDN、有道云等都支持。</p>
<p>文件开头加上以下信息：</p>
<table>
<thead>
<tr>
<th>属性</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>title</td>
<td>标题，文章标题由这个决定，跟文件名无关</td>
</tr>
<tr>
<td>data</td>
<td>日期</td>
</tr>
<tr>
<td>tags</td>
<td>标签，多数主题支持按标签查询。例子中为多标签写法，单个标签不用括号</td>
</tr>
<tr>
<td>categories</td>
<td>分类，多数主题支持按分类查询</td>
</tr>
</tbody>
</table>
<p>例如：</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token punctuation">---</span>
<span class="token key atrule">title</span><span class="token punctuation">:</span> hexo+码云 从搭建到管理一站解决

<span class="token key atrule">data</span><span class="token punctuation">:</span> <span class="token datetime number">2018-03-28 17:04:00</span>

<span class="token key atrule">tags</span><span class="token punctuation">:</span> <span class="token punctuation">[</span>Hexo<span class="token punctuation">,</span>Sample<span class="token punctuation">]</span>

<span class="token key atrule">categories</span><span class="token punctuation">:</span> Hexo
<span class="token punctuation">---</span>

<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre></div>
<p>总之，将 Markdown 格式的新博客放到 source/_post （重要的说三遍）里，且有头部信息就行。然后，请执行以下命令：</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">hexo generate    #或者 hexo g
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<p>以上命令生成静态页面（即经过主题渲染的页面，public 文件夹里）。然后，使用 server 命令在本地测试</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">hexo server
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<p>首次上传前用 Node.js 命令行工具执行以下命令，用来安装 hexo 上传工具。第二次之后不必执行。</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">npm install hexo-deployer-git --save
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<p>然后，使用以下命令上传：</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">hexo deploy    #或者 hexo d
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<h2>创建页面</h2>
<p>以创建标签（tags） 分页为例：</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">hexo new page "tags"
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<div class="image-package">
<div class="image-container" style="max-width: 227px; max-height: 165px; background-color: transparent;">
<div class="image-container-fill" style="padding-bottom: 72.69%;"></div>
<div class="image-view" data-width="227" data-height="165"><img data-original-src="//upload-images.jianshu.io/upload_images/10948567-13c17ab87237d890" data-original-width="227" data-original-height="165" data-original-format="image/png" data-original-filesize="3955" style="cursor: zoom-in;" data-image-index="3" class="" src="//upload-images.jianshu.io/upload_images/10948567-13c17ab87237d890?imageMogr2/auto-orient/strip|imageView2/2/w/227"></div>
</div>
<div class="image-caption">创建好的页面</div>
</div>
<p>在 source 文件夹下出现了名为 tags 的文件夹，其中包含了一个 index.md，这个便是新的页面</p>
<p>标签、分类（categories） 分页不用编辑，由主题自动填充。其他页面如关于（about）、联系（contact）等的内容，需要手动编辑其文件夹中的 index.md</p>
<p>然鹅，新页面是否可用，一般由主题配置决定，敬请继续往下阅读</p>
<h2>更改主题</h2>
<p>主题是 HEXO 非常重要的一块内容</p>
<h3>找主题</h3>
<ul>
<li><p>进入 GitHub ，搜索 hexo-theme，进入任意主题项目</p></li>
<li><p>进入 hexo 官网/主题 ，点击示例主题的名字，会进入 GitHub 对应的项目</p></li>
</ul>
<h3>导入主题</h3>
<p>这里以比较流行的 next 主题为例</p>
<ul>
<li>在 Hexo 目录下进入 Git Bash，执行以下命令。</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">git clone https://github.com/iissnan/hexo-theme-next themes/next
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<ul>
<li>或者，直接到 themes 目录下执行</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-cmd"><code class="cmd  language-cmd">git clone https://github.com/iissnan/hexo-theme-next
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<h3>设置主题</h3>
<p>根目录下的 _config.yml 中配置主题</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token key atrule">theme</span><span class="token punctuation">:</span> next
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<h3>主题配置</h3>
<p>根目录下 _config.yml 包含了很多配置，但是还有大量的配置由主题目录下的 _config.yml 来设定。不同主题的配置不尽相同，这里还是以 next 主题为例</p>
<ul>
<li>菜单设置</li>
</ul>
<p>这里设置除主页外，要显示的页面</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token comment"># 选项名：页面名（即上面一节创建的文件夹名） || font-awesome 图标</span>

<span class="token key atrule">menu</span><span class="token punctuation">:</span>

  <span class="token key atrule">home</span><span class="token punctuation">:</span> / <span class="token punctuation">|</span><span class="token punctuation">|</span> home

  <span class="token key atrule">archives</span><span class="token punctuation">:</span> /archives/ <span class="token punctuation">|</span><span class="token punctuation">|</span> archive

  <span class="token key atrule">tags</span><span class="token punctuation">:</span> /tags/ <span class="token punctuation">|</span><span class="token punctuation">|</span> tags

  <span class="token key atrule">categories</span><span class="token punctuation">:</span> /categories/ <span class="token punctuation">|</span><span class="token punctuation">|</span> th<span class="token punctuation">-</span>large

  <span class="token key atrule">contact</span><span class="token punctuation">:</span> /contact/ <span class="token punctuation">|</span><span class="token punctuation">|</span> phone

<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>社交链接</li>
</ul>
<p>设置在指定的位置显示的社交链接</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token comment"># 社交途径：路径 || font-awesome 图标</span>

<span class="token key atrule">social</span><span class="token punctuation">:</span>

  <span class="token key atrule">GitHub</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//gitee.com/itscloudy <span class="token punctuation">|</span><span class="token punctuation">|</span> github

  <span class="token key atrule">E-Mail</span><span class="token punctuation">:</span> itscloudy@foxmail.com <span class="token punctuation">|</span><span class="token punctuation">|</span> envelope

<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>网站左上角的图标</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token comment"># 后面的文件路径都是在 themes/next/source 目录下的</span>

<span class="token key atrule">favicon</span><span class="token punctuation">:</span>

  <span class="token key atrule">small</span><span class="token punctuation">:</span> /images/favicon<span class="token punctuation">-</span>16x16<span class="token punctuation">-</span>next.png              <span class="token comment"># 小尺寸图标</span>

  <span class="token key atrule">medium</span><span class="token punctuation">:</span> /images/favicon<span class="token punctuation">-</span>32x32<span class="token punctuation">-</span>next.png              <span class="token comment"># 中尺寸图标</span>

  <span class="token key atrule">apple_touch_icon</span><span class="token punctuation">:</span> /images/apple<span class="token punctuation">-</span>touch<span class="token punctuation">-</span>icon<span class="token punctuation">-</span>next.png <span class="token comment"># apple_touch 图标</span>

  <span class="token key atrule">safari_pinned_tab</span><span class="token punctuation">:</span> /images/logo.svg                <span class="token comment"># safari_pinned 图标</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>代码样式</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token comment"># 有5中样式可选 normal，night，night eighties，night blue，night bright</span>

<span class="token key atrule">highlight_theme</span><span class="token punctuation">:</span> night eighties
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre></div>
<ul>
<li>网站尾部显示内容</li>
</ul>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-yml"><code class="yml  language-yml"><span class="token key atrule">footer</span><span class="token punctuation">:</span>

  <span class="token key atrule">since</span><span class="token punctuation">:</span> <span class="token number">2018      </span><span class="token comment"># 起始年</span>

  <span class="token key atrule">icon</span><span class="token punctuation">:</span> user      <span class="token comment"># 起始年和版权之间的小图标（font-awesome 图标）</span>

  <span class="token key atrule">copyright</span><span class="token punctuation">:</span>      <span class="token comment"># 版权，默认为作者名</span>

  <span class="token key atrule">powered</span><span class="token punctuation">:</span> <span class="token boolean important">true    </span><span class="token comment"># 显示“由HEXO强力驱动”</span>

  <span class="token key atrule">theme</span><span class="token punctuation">:</span>

    <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true  </span><span class="token comment"># 显示主题名</span>

    <span class="token key atrule">version</span><span class="token punctuation">:</span> <span class="token boolean important">true  </span><span class="token comment"># 显示主题版本</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre></div>
<p>提示：font-awesome 是一个图标库，<a href="https://links.jianshu.com/go?to=http%3A%2F%2Fwww.fontawesome.com.cn%2Ffaicons%2F" target="_blank">在这里搜索 font-awesome 图标</a>，使用给出的图标名称就OK</p>
<p>以上为常用配置，更多配置请自行百度</p>
<h1>其他</h1>
<h2>显示图片</h2>
<p>博客图片的一般显示方式为 ：</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-md"><code class="md  language-md"><span class="token url">![<span class="token content">描述</span>](/img/picture.png)</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<p>然鹅这种方法时常会失效，我也布吉岛为什么（就一个字儿没动，突然就加载不了了）。以下是官方的解释</p>
<blockquote>
<p>通过常规的 markdown 语法和相对路径来引用图片和其它资源可能会导致它们在存档页或者主页上显示不正确。在Hexo 2时代，社区创建了很多插件来解决这个问题。但是，随着Hexo 3 的发布，许多新的标签插件被加入到了核心代码中。这使得你可以更简单地在文章中引用你的资源。—— Hexo 官网</p>
</blockquote>
<p>所以我建议我们应该用官方推荐下面这种方式引用图片和其他资源</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-md"><code class="md  language-md">{% img /img/picture.png 描述 %}
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<p>图片也可以上传到七牛云、腾讯云等的“对象储存”服务上，使用 http 来显示。也可以使用简书和 CSDN 等博客类网站在上传图片后生成的图片路径。</p>
<div class="_2Uzcx_"><button class="VJbwyy" type="button" aria-label="复制代码"><i aria-label="icon: copy" class="anticon anticon-copy"><svg viewBox="64 64 896 896" focusable="false" class="" data-icon="copy" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M832 64H296c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h496v688c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V96c0-17.7-14.3-32-32-32zM704 192H192c-17.7 0-32 14.3-32 32v530.7c0 8.5 3.4 16.6 9.4 22.6l173.3 173.3c2.2 2.2 4.7 4 7.4 5.5v1.9h4.2c3.5 1.3 7.2 2 11 2H704c17.7 0 32-14.3 32-32V224c0-17.7-14.3-32-32-32zM350 856.2L263.9 770H350v86.2zM664 888H414V746c0-22.1-17.9-40-40-40H232V264h432v624z"></path></svg></i></button><pre class="line-numbers  language-md"><code class="md  language-md">{% img https:... 描述 %}
<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre></div>
<h2>更多</h2>
<p>更多信息可以查阅 <a href="https://links.jianshu.com/go?to=https%3A%2F%2Fhexo.io%2Fzh-cn%2Fdocs%2F" target="_blank">HEXO 官网文档</a></p>
<h1>示例：<a href="https://links.jianshu.com/go?to=https%3A%2F%2Fitscloudy.gitee.io%2Fblog%2F" target="_blank">我的博客</a>
</h1>
</article>